export const locSet = (name:string, data:any) => {
  const item = typeof data === 'string' ? data : JSON.stringify(data)
  localStorage.setItem(name, item)
}
export const locGet = (name:string, type:string = 'string') => {
  const data = localStorage.getItem(name)
  let result:any
  if (data) {
    if (type === 'string') {
      result = data
    } else if (type === 'O' || type === 'A' || type === 'N') {
      result = JSON.parse(data)
    }
  } else {
    result = data
  }
  return result
}
